<?php
/**
 * Created by PhpStorm.
 * User: w-pc
 * Date: 2017/03/01
 * Time: 23:22
 */

namespace Home\Controller;
use Think\Controller;
class ArticleController extends Controller {
    public function index(){
        $page = request('get','int','page',1);
        if($page==0) $page = 1;
        $article_list = D('Article')->getArticleByList();
        $pageNo = pageNo($article_list);
        $article_list = pageList($page,$article_list);
        $article_list_new = D('Article')->get_ArticleNumList(10);
        $this->assign('article_list_new',$article_list_new);
        $this->assign('article_list',$article_list);
        $this->assign('pageNo',$pageNo);
        $this->assign('page',$page);
        //用来显示顶部图像和标题等元素
        $this->assign('index',D('Index')->get_Info());
        $this->display();
    }
    public function show(){
        $a_id = request('get','int','a_id');
        $article = D('Article')->getArticleByOne($a_id);
//        var_dump($article);
//        exit();
        $this->assign('article',$article);
        //用来显示顶部图像和标题等元素
        $this->assign('index',D('Index')->get_Info());
        $this->display();
    }
    public function markdown(){
        $a_id = request('get','int','a_id');
        $article = D('Article')->getArticleByOne($a_id);
        $this->assign('article',$article);
        $this->display();
    }
}